<template>
	<view >
		<view class="tit">
			{{taskTip}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userid:"",
				taskAppId:"",
				taskTip: `开始出货`
			};
		},
		onShow() {
			this.userid = uni.getStorageSync("uid");
			this.taskAppId = uni.getStorageSync("taskAppId");
			this.$forceUpdate();
			setTimeout(()=>{
				if(this.userid){
					this.taskRun()
				}
			},500)
		},
		methods:{
			async getPoints() {
				const taskAppId = this.taskAppId;
				if (taskAppId) {
					return this.$util.doPostJson(`/wx/byUserIdAddIntegral`, {
						appid: taskAppId,
						userid: this.userid
					}, {}, false);
				}
				return null;
			},
			async taskRun() {
				const {
					data: {
						message,
						code
					}
				} = await this.getPoints();
				if (code === 200) {
					this.taskTip = '出货成功'
				} else {
					this.taskTip = "出货失败";
				}
			}
		}
	}
</script>

<style lang="scss">
	
	.page{
		width: 100%;
		height: 100%;
	}
	
	.tit{
		position:fixed;
		top:50%;
		left: 50%;
		transform: translate(-50%, -50%);
		font-size: 50rpx;
		color: #ff0000;
	}
</style>
